﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sharp.Infrastructure;
using Sharp.Portal.AdminLTE.Provider;
using Sharp.Portal.Mvc.List;

namespace Sharp.Portal.AdminLTE
{
    /// <summary>
    /// ListPage 实现
    /// </summary>
    public partial class BSSharpList : SharpList
    {
        /// <summary>
        /// ListPage 实现
        /// </summary>
        public BSSharpList() : base()
        {
            ListControlId = "dataList";
        }
        /// <summary>
        /// 响应式布局
        /// </summary>
        public bool Responsive { get; set; }
        /// <summary>
        /// 初始化完成
        /// </summary>
        public override void InitComplete()
        {
            base.InitComplete();
            Responsive = IsMobileDevice();
        }
        /// <summary>
        /// 处理移动端配置
        /// </summary>
        public override void HandleMobileDevice()
        {
            if (!IsMobileDevice()) return;

            Responsive = true;
            //去掉冻结列
            this.ColumnItems.Where(x => x.Locked).ToList().ForEach(x =>
              {
                  x.Locked = false;
              });
        }
        /// <summary>
        /// 初始化适配器
        /// </summary>
        public override void InitProvider()
        {
            if (this.Provider == null)
                this.Provider = new ListPage();
        }
    }
}
